<?php
require_once('Init.php');
class GetFiles
{
    protected $_at;

    protected $_files;

    public function action() {
        $this->getAllGaleriaFiles();
    }

    public function getAllGaleriaFiles()
    {
        $files = array();
        $dir = 'Images/Images/';
        $handler = opendir($this->getDocumentRoot() . $dir);

        while($file = readdir($handler)) {
            if("." != $file && ".." != $file) {
                    $files[] = $dir . $file;
            }
        }
        $this->_files = array();
        $this->_files = $files;
        $this->getAt()->assign('files', $this->_files);
        return true;
    }

    /**
     * @return Smarty
     */
    public function getAt()
    {
        if (!$this->_at) {
            $this->_at = Controller::getActionTemplate();
        }
        return $this->_at;
    }

    public function setAt($at)
    {
        $this->_at = $at;
    }

    public function getFiles()
    {
        return $this->_files;
    }

    public function getDocumentRoot()
    {
        $ret = getDocumentRoot();
        return $ret;
    }
}
//
$getFiles = new GetFiles();
$getFiles->getAllGaleriaFiles();
	
	
